package com.project.fortuneteller.mappers;

import com.project.fortuneteller.pojo.Book;
import com.project.fortuneteller.pojo.Content;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LearnContentMapper {

    /**
     * 通过 书籍ID 获取 了 文章信息
     * @param id
     * @return
     */

    @Select("select * from learn_content where  book_id= #{id}")
     List<Content> selectByBookId(@Param("id") String id);

    /**
     * 获取内容的操作
     * @param id
     * @return
     */
    @Select("select * from learn_content where id = #{id}")
    List<Content> selectById(@Param("id") String id);

    /**
     * 实现操作
     *   获取 用户的 信息
     */
    @Select("select * from learn_content  where book_name like #{content} or book_intro  like #{content}")
    List<Book> searchLikeBook(@Param("content") String content);

    /**
     * 用户的模糊匹配
     * @param content
     * @return
     */
    @Select("select * from learn_content where book_name like #{content} or content  like #{content}")
    List<Content> searchLikeContent(@Param("content") String content);


}
